﻿package game.account.shop {
	import flash.events.Event;
	import flash.geom.Rectangle;
	import game.objects.GameObject;
	import game.lang.Lang;
	import game.ui.Image;
	import game.ui.Money;
	
	public class ShopCarItem extends GameObject {
		
		public var id:int;
		
		private var image:Image;
		private var money:Money
		
		public function ShopCarItem(id:int, cost:Number, type:String = null):void {
			this.id = id;
			
			this.draw(new Rectangle(0, 0, 159, 95), 0x000000, 0.7);
			
			image = new Image(logoURL, this.width, this.height/2);
			addChild(image);
			
			money = new Money (type, cost, Money.LEFT);
			money.y = this.height/2 + 5;
			money.x = (this.width - money.width)/2;
			addChild(money);
			
			this.mouseChildren = false;
			
			this.buttonMode = true;
		}
		
		public function get logoURL():String {
			return Lang.regexp(config.dirs.URL_logo, {host: config.host, dir: config.dirs.models, id: String(id)});
		}
		
	}
	
}